package com.lagou.product.mq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

@Component
public class Producer {

    @Autowired
    private KafkaTemplate<String, Long> kafkaTemplate;

    @Value(value = "${kafka.topic.name}")
    private String topic;



    public void send(Long productId){
        kafkaTemplate.send(topic, productId);
    }

}

